import requests

import app


class Department:
    def __init__(self):
        self.url_part = app.BASE_URL + "/api"
        # self.session = requests.Session()

    def login_part(self, session, headers, jsonData):
        return session.post(url=self.url_part + "/sys/login",
                            headers=headers,
                            json=jsonData)

    def select_part_all(self, session, headers):
        return session.get(url=self.url_part + "/company/department",
                           headers=headers)

    def add_part(self, session, headers, jsonData):
        return session.post(url=self.url_part + "/company/department",
                            headers=headers,
                            json=jsonData)

    def get_part(self, session, emp_id, headers):
        return session.get(url=self.url_part + "/company/department" + "/" + emp_id,
                           headers=headers)

    def update_part(self, session, emp_id, headers, jsonData):
        return session.put(url=self.url_part + "/company/department" + "/" + emp_id,
                           headers=headers,
                           json=jsonData)

    def delete_part(self, session, emp_id, headers):
        return session.delete(url=self.url_part + "/company/department" + "/" + emp_id,
                              headers=headers)
